<template>
<el-select :value="value" class="am-w-full" @change="handleChange">
  <el-option v-for="dict in dictOptions"
             :key="dict.dictValue"
             :label="dict.dictLabel"
             :value="dict.dictValue"
  />
</el-select>
</template>

<script>
import {isEmpty} from "lodash";

export default {
  props: {
    value: [String, Number],
    dict: String,
  },
  data() {
    return {
      dictOptions: []
    }
  },
  methods: {
    handleChange(value) {
      this.$emit('input', value)
    }
  },
  created() {
    if(!isEmpty(this.dict)) {
      this.getDicts(this.dict).then(response => {
        this.dictOptions = response.data
      })
    }
  }
}
</script>

<style>

</style>
